Callbacks - Stdin

These routines poll the Standard Input queue.  If keys are expected from the keyboard but none are available (return value = 0), control must be returned to the nShell application to allow processing.  Subsequent calls to Stdin routines will contain the new keystrokes.

These routines are compatible with nShell I/O redirection.

NSH_getchar

int  NSH_getchar(void);

PARAMETERS

none

RETURNS

0

no characters available

-1

end of input

others

next character in input queue

PROCESS

This routine polls the Standard Input queue.  If any characters are available, they are returned to the external command.

On the console, a control-D is used to signal end of input.

NSH_gets

int  NSH_gets(char *s, int max_len);

PARAMETERS

char
*s

address of a character buffer to fill

int
max_len
maximum number of characters

RETURNS

0

no characters available

-1

end of input

others

length of input string

PROCESS

This routine polls the Standard Input queue.  If any characters are available, they are returned to the external command.  Characters are transferred to the "s" buffer until it is filled, or until a Return character or End Of Input is encountered.  Return characters are placed in the "s" buffer.  If the "s" buffer is smaller than a line of input, the incoming string will be split among subsequent calls.

On the console, a control-D is used to signal end of input.

NSH_getStr

int  NSH_getStr(Str255 s);

PARAMETERS

Str255
s
address of a Pascal string to fill

RETURNS

0

no characters available

-1

end of input

others

length of input string

PROCESS

This routine polls the Standard Input queue.  If any characters are available, they are returned to the external command.  Characters are transferred to the "s" string until it is filled, or until a Return character or End Of Input is encountered.  Return characters are placed in the "s" string.  If a line of input is longer than 255 characters, the incoming string will be split among subsequent calls.

On the console, a control-D is used to signal end of input.